/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package memory;

import javax.swing.ImageIcon;
import javax.swing.JButton;

/**
 *
 * @author DAM110
 */
public class BotonCarta extends JButton{

    private String ruta;
    private static String reverso = "/imagenes/reverso.jpg";
    private boolean mostrado;    
    
    public BotonCarta(String ruta) {
        super();
        ImageIcon icono = new ImageIcon(this.getClass().getResource(ruta));
        super.setIcon(icono);
        mostrado = true;
        
        this.ruta = ruta;
    }  
    
    public static String getReverso() {
        return reverso;
    }
    
    public void ponerReverso(){
        
        ImageIcon icono = new ImageIcon(this.getClass().getResource(reverso));
        super.setIcon(icono);
        
        mostrado = false;
    }
    
    public void ponerCara(){
        
        ImageIcon icono = new ImageIcon(this.getClass().getResource(ruta));
        super.setIcon(icono);
        this.repaint();
        mostrado = true;
    }

    public String getRuta() {
        return ruta;
    }

    public boolean isMostrado() {
        return mostrado;
    }  
    
    @Override
    public void setEnabled(boolean si){
       super.setEnabled(si); 
       mostrado = false;        
    }
    
}
